
<script type="text/javascript" language="javascript">
    definWinPrint2('winprint2', 'winprint2_id', 'widget.printout2', 
    'Preview PDF',true,false,'printoutpdf2');
    
    var twinsiswaBaseStore = createStore(false, 'mtwinsiswaBaseStore',['nis','nama','kd_kelas','kelas'],'<?php echo base_url(); ?>' + 'datasiswa/get_rows_twin');
    var allsiswaStoreBase=createStore(false, 'mallsiswaStoreBase',['nis','nama','kd_kelas','kelas'],'<?php echo base_url(); ?>' + 'datasiswa/get_rows_all');
    var combo_bulanbase_Store=createArrayStore2( ['num', 'name'],bulan_data);
    var comboKelasStoreBase = createStore(false, 'mcomboKelasStoreBase', ['kd_kelas','keterangan'], '<?php echo base_url(); ?>' + 'masterkelas/get_rows_combo');
        
    defineTwinSiswa_windows('WindowfindsiswaBase', 'WindowfindsiswaBase_id', twinsiswaBaseStore, function(){			
        var sm = this.getSelectionModel();
        var sel = sm.getSelection();
        //                console.log('doublekil');
        if (sel.length > 0) {	
            Ext.getCmp('base_nis').setValue(sel[0].get('nis'));  
            Ext.getCmp('base_nama').setValue(sel[0].get('nama'));  
            Ext.getCmp('base_kd_kelas').setValue(sel[0].get('kd_kelas'));  
            Ext.getCmp('WindowfindsiswaBase_id').close();            
        }
    });
    Ext.define('winnis', {
        extend          : 'Ext.window.Window',
        title           : 'Parameter NIS',
        width           : 400,
        height          : 200,
        layout          : 'fit',
        autoShow        : true,
        modal           : true,
        alias           : 'widget.winnis',
        id              : 'winnis_id',
        items:[{
                //            regin:'center',
                xtype:'panel',
                frameHeader:false,
                bodyPadding: 5,
                //                    title: 'Pilih Akun',
                layout: 'form',
                buttonAlign: 'center',
                modal: true,
                width: 400,
                height: 300,
                closeAction: 'hide',
                plain: true,
                defaultType: 'textfield',
                defaults:{
                    labelWidth:80,
                    anchor:'90%'
                },
                items: [{
                        xtype: 'twincombo'
                        ,name: 'nis'
                        ,fieldLabel: 'NIS',
//                        tooltip: 'Field tidak boleh kosong',
//                        afterLabelTextTpl: required_css,
                        id:'base_nis',
                        store:twinsiswaBaseStore,
                        menu:'WindowfindsiswaBase',
                        enableKeyEvents:true,
                        emptyText:'Entry / Pilih Siswa',
                        allowBlank:true
                        ,listeners:{
                            keyup: function(f,e,opt) { 
                                if (e.getKey()==113){
                                    f.onTrigger1Click();
                                }          
                                if (e.getKey()==13){
                                    if(f.getValue().length>0){
                                        var rec=  findNis(f.getValue(), allsiswaStoreBase);                                                
                                        if(rec){
                                                    
                                            Ext.getCmp('base_nama').setValue(rec.get('nama'));
                                            Ext.getCmp('base_kd_kelas').setValue(rec.get('kd_kelas'));
                                            //                                                    Ext.getCmp('sim_th_ajaran').focus();
                                        }else{
                                            set_message(2,'Data Siswa Tidak Terdaftar !!!');
                                            f.setValue('');
                                        }
                                    };
                                }
                            }
                        }
                        //                    ,readOnly:true                                    
                    },{
                        name: 'nama',
                        id: 'base_nama',
                        fieldLabel: 'Nama Siswa',
                        maxLength:50,
                        emptyText: 'Nama Siswa',
                        allowBlank: true
                        ,readOnly:true                    
                    },{
                        xtype: 'combo',                        
                        name:'kd_kelas',
                        //                                    tooltip: 'Field tidak boleh kosong',
                        //                                    afterLabelTextTpl: required_css,
                        fieldLabel: 'Kelas',                        
                        id: 'base_kd_kelas',
                        mode:'local',
                        store: comboKelasStoreBase,
                        valueField: 'kd_kelas',
                        displayField: 'keterangan',
                        typeAhead: true,
                        triggerAction: 'all',                    
                        //                                    allowBlank: false,
                        editable: true,                                    
                        hiddenName: 'kd_kelas',
                        margins: '0 0 0 5',
                        emptyText: 'Pilih Kelas'
                                
                    }   
                ],
                        buttons:[{
                                text: 'Tampilkan',                    
                                itemId: 'btn_base_proses',
                                id:'btn_base_proses_id',
                                iconCls: 'icon-proses',
                                scope: this,
                                handler: function(){
                        
                                }
                            }]
            }],
            listeners:{
                show:function(){
                    allsiswaStoreBase.load();
                    comboKelasStoreBase.load();
                }
            },
        initComponent   : function(){
            this.callParent(arguments);
        }

    });
    
    Ext.define('winnisthbl', {
        extend          : 'Ext.window.Window',
        title           : 'Parameter NIS-THBL',
        width           : 400,
        height          : 200,
        layout          : 'fit',
        autoShow        : true,
        modal           : true,
        alias           : 'widget.winnisthbl',
        id              : 'winnisthbl_id',
        items:[{
                //            regin:'center',
                xtype:'panel',
                frameHeader:false,
                bodyPadding: 5,
                //                    title: 'Pilih Akun',
                layout: 'form',
                buttonAlign: 'center',
                modal: true,
                width: 400,
                height: 300,
                closeAction: 'hide',
                plain: true,
                defaultType: 'textfield',
                defaults:{
                    labelWidth:80,
                    anchor:'90%'
                },
                items: [{
                        xtype: 'twincombo'
                        ,name: 'nis'
                        ,fieldLabel: 'NIS',
//                        tooltip: 'Field tidak boleh kosong',
//                        afterLabelTextTpl: required_css,
                        id:'base_nis',
                        store:twinsiswaBaseStore,
                        menu:'WindowfindsiswaBase',
                        enableKeyEvents:true,
                        emptyText:'Entry / Pilih Siswa',
                        allowBlank:true
                        ,listeners:{
                            keyup: function(f,e,opt) { 
                                if (e.getKey()==113){
                                    f.onTrigger1Click();
                                }          
                                if (e.getKey()==13){
                                    if(f.getValue().length>0){
                                        var rec=  findNis(f.getValue(), allsiswaStoreBase);                                                
                                        if(rec){
                                                    
                                            Ext.getCmp('base_nama').setValue(rec.get('nama'));
                                            Ext.getCmp('base_kd_kelas').setValue(rec.get('kd_kelas'));
                                            //                                                    Ext.getCmp('sim_th_ajaran').focus();
                                        }else{
                                            set_message(2,'Data Siswa Tidak Terdaftar !!!');
                                            f.setValue('');
                                        }
                                    };
                                }
                            }
                        }
                        //                    ,readOnly:true                                    
                    },{
                        name: 'nama',
                        id: 'base_nama',
                        fieldLabel: 'Nama Siswa',
                        maxLength:50,
                        emptyText: 'Nama Siswa',
                        allowBlank: true
                        ,readOnly:true                    
                    },{
                        xtype: 'combo',                        
                        name:'kd_kelas',
                        //                                    tooltip: 'Field tidak boleh kosong',
                        //                                    afterLabelTextTpl: required_css,
                        fieldLabel: 'Kelas',                        
                        id: 'base_kd_kelas',
                        mode:'local',
                        store: comboKelasStoreBase,
                        valueField: 'kd_kelas',
                        displayField: 'keterangan',
                        typeAhead: true,
                        triggerAction: 'all',                    
                        //                                    allowBlank: false,
                        editable: true,                                    
                        hiddenName: 'kd_kelas',
                        margins: '0 0 0 5',
                        emptyText: 'Pilih Kelas'
                                
                    } ,{
                        xtype:'fieldcontainer',
                        fieldLabel:'ThBl Periode',
                        //                    labelWidth: 130,
                        layout: 'hbox',                    
                        defaultType: 'textfield',                    
                        //                    margin: '0 0 5 0',
                        defaults: {
                            labelWidth: 80,
                            labelAlign: 'right'
                            ,hideLabel: 'true'
                        },
                        tooltip: 'Field tidak boleh kosong',
                        afterLabelTextTpl: required_css,
                        items: [
                            {
                                xtype:'numberfield',
                                name:'tahun',
                                fieldLabel:'Tahun',
                                id: 'base_tahun',
                                emptyText:'Tahun',
                                allowBlank: false,                                                                        
                                //                            hideTrigger: true,
                                fieldStyle: 'text-align: right;',
                                minValue: new Date().getFullYear()
                                ,flex:1
                            },
                            {
                                xtype: 'combobox',
                                name: 'bulan',
                                id: 'base_bulan',
                                displayField: 'name',
                                valueField: 'num',
                                queryMode: 'local',
                                emptyText: 'Bulan',
                                hiddenName:'bulan',
                                //                            margins: '0 6 0 0',
                                store: combo_bulanbase_Store,
                                width: 100,
                                allowBlank: false,
                                forceSelection: true
                                ,flex:1
                            }
                        ]
                    }  
                ],
                        buttons:[{
                                text: 'Tampilkan',                    
                                itemId: 'btn_base_proses',
                                id:'btn_base_proses_id',
                                iconCls: 'icon-proses',
                                scope: this,
                                handler: function(){
                        
                                }
                            }]
            }],
            listeners:{
                show:function(){
                    allsiswaStoreBase.load();
                    comboKelasStoreBase.load();
                }
            },
        initComponent   : function(){
            this.callParent(arguments);
        }

    });

    var combothajaranStoreBase = createStore(false, 'mcombothajaranStoreBase',['id_th_ajaran','tahun_ajaran'],'<?php echo base_url(); ?>' + 'tahunajaran/get_rows_combo');
    var semesterstoreBase =createArrayStore([['I','Ganjil'],['II','Genap']]);
    
    defineTwinSiswa_windows('WindowfindsiswaTnt', 'WindowfindsiswaTnt_id', twinsiswaBaseStore, function(){			
        var sm = this.getSelectionModel();
        var sel = sm.getSelection();
        //                console.log('doublekil');
        if (sel.length > 0) {	
            Ext.getCmp('tnt_nis').setValue(sel[0].get('nis'));  
            Ext.getCmp('tnt_nama').setValue(sel[0].get('nama'));  
            Ext.getCmp('tnt_kd_kelas').setValue(sel[0].get('kd_kelas'));  
            Ext.getCmp('WindowfindsiswaTnt_id').close();            
        }
    });
    
    Ext.define('winthnisthbl', {
        extend          : 'Ext.window.Window',
        title           : 'Parameter THAJARAN-NIS-THBL',
        width           : 400,
        height          : 250,
        layout          : 'fit',
        autoShow        : true,
        modal           : true,
        alias           : 'widget.winthnisthbl',
        id              : 'winthnisthbl_id',
        items:[{
                //            regin:'center',
                xtype:'panel',
                frameHeader:false,
                bodyPadding: 5,
                id:'panel_tnt',
                //                    title: 'Pilih Akun',
                layout: 'form',
                buttonAlign: 'center',
                modal: true,
                width: 400,
                height: 300,
                closeAction: 'hide',
                plain: true,
                defaultType: 'textfield',
                defaults:{
                    labelWidth:85,
                    anchor:'90%'
                },
                items: [
                    {
                                xtype:'combo',
                                afterLabelTextTpl: required_css,
                                name: 'id_th_ajaran',
                                id: 'tnt_id_th_ajaran',
                                fieldLabel: 'Tahun Ajaran',                                    
                                //                    labelWidth: 80,
                                emptyText: 'Tahun Ajaran'
                                ,mode:'local',
                                store: combothajaranStoreBase,
                                valueField: 'id_th_ajaran',
                                displayField: 'tahun_ajaran',
                                typeAhead: true,
                                triggerAction: 'all',                    
                                allowBlank: false,
                                editable: false  ,
                                hiddenName:'id_th_ajaran'
                                ,listeners:{
                                    select:function(cmb,rec){
                                        console.log(rec[0].get('tahun_ajaran'));
                                    }
                                }
                            },
                            {
                                xtype: 'combo',                                                            
//                                tooltip: 'Field tidak boleh kosong',
//                                afterLabelTextTpl: required_css,
                                                                    fieldLabel: 'semester',                        
                                id: 'tnt_semester',
                                mode:'local',
                                store: semesterstoreBase,
                                valueField: 'mid',
                                displayField: 'mtext',
                                typeAhead: true,
                                triggerAction: 'all',                    
                                allowBlank: true,
                                editable: false,                                
                                emptyText: 'Semester'    ,
                                name:'semester',
                                hiddenName:'semester'
                            },
                    {
                        xtype: 'twincombo'
                        ,name: 'nis'
                        ,fieldLabel: 'NIS',
//                        tooltip: 'Field tidak boleh kosong',
//                        afterLabelTextTpl: required_css,
                        id:'tnt_nis',
                        store:twinsiswaBaseStore,
                        menu:'WindowfindsiswaTnt',
                        enableKeyEvents:true,
                        emptyText:'Entry / Pilih Siswa',
                        allowBlank:true
                        ,listeners:{
                            keyup: function(f,e,opt) { 
                                if (e.getKey()==113){
                                    f.onTrigger1Click();
                                }          
                                if (e.getKey()==13){
                                    if(f.getValue().length>0){
                                        var rec=  findNis(f.getValue(), allsiswaStoreBase);                                                
                                        if(rec){
                                                    
                                            Ext.getCmp('tnt_nama').setValue(rec.get('nama'));
                                            Ext.getCmp('tnt_kd_kelas').setValue(rec.get('kd_kelas'));
                                            //                                                    Ext.getCmp('sim_th_ajaran').focus();
                                        }else{
                                            set_message(2,'Data Siswa Tidak Terdaftar !!!');
                                            f.setValue('');
                                        }
                                    };
                                }
                            }
                        }
                        //                    ,readOnly:true                                    
                    },{
                        name: 'nama',
                        id: 'tnt_nama',
                        fieldLabel: 'Nama Siswa',
                        maxLength:50,
                        emptyText: 'Nama Siswa',
                        allowBlank: true
                        ,readOnly:true                    
                    },{
                        xtype: 'combo',                        
                        name:'kd_kelas',
                        //                                    tooltip: 'Field tidak boleh kosong',
                        //                                    afterLabelTextTpl: required_css,
                        fieldLabel: 'Kelas',                        
                        id: 'tnt_kd_kelas',
                        mode:'local',
                        store: comboKelasStoreBase,
                        valueField: 'kd_kelas',
                        displayField: 'keterangan',
                        typeAhead: true,
                        triggerAction: 'all',                    
                        //                                    allowBlank: false,
                        editable: true,                                    
                        hiddenName: 'kd_kelas',
                        margins: '0 0 0 5',
                        emptyText: 'Pilih Kelas'
                                
                    } ,{
                        xtype:'fieldcontainer',
                        fieldLabel:'ThBl Periode',
                        //                    labelWidth: 130,
                        layout: 'hbox',                    
                        defaultType: 'textfield',                    
                        //                    margin: '0 0 5 0',
                        defaults: {
                            labelWidth: 80,
                            labelAlign: 'right'
                            ,hideLabel: 'true'
                        },
//                        tooltip: 'Field tidak boleh kosong',
//                        afterLabelTextTpl: required_css,
                        items: [
                            {
                                xtype:'numberfield',
                                name:'tahun',
                                fieldLabel:'Tahun',
                                id: 'tnt_tahun',
                                emptyText:'Tahun',
                                allowBlank: true,                                                                        
                                //                            hideTrigger: true,
                                fieldStyle: 'text-align: right;',
                                minValue: new Date().getFullYear()
                                ,flex:1
                            },
                            {
                                xtype: 'combobox',
                                name: 'bulan',
                                id: 'tnt_bulan',
                                displayField: 'name',
                                valueField: 'num',
                                queryMode: 'local',
                                emptyText: 'Bulan',
                                hiddenName:'bulan',
                                //                            margins: '0 6 0 0',
                                store: combo_bulanbase_Store,
                                width: 100,
                                allowBlank: true,
                                forceSelection: true
                                ,flex:1
                            }
                        ]
                    }  
                ],
                        buttons:[{
                                text: 'Tampilkan',                    
                                itemId: 'btn_tnt_proses',
                                id:'btn_tnt_proses_id',
                                iconCls: 'icon-proses',
                                scope: this,
                                handler: function(){
                        
                                }
                            }]
            }],
            listeners:{
                show:function(){
                    allsiswaStoreBase.load();
                    comboKelasStoreBase.load();
                }
            },
        initComponent   : function(){
            this.callParent(arguments);
        }

    });
</script>
<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$this->load->view('laporan/daftarsiswa');
$this->load->view('laporan/daftarbiayasiswa');
$this->load->view('laporan/saldopiutang');
$this->load->view('laporan/payment');
$this->load->view('laporan/paymentrekap');
?>